home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Mar. 14, 1999
- // Author: ms
- //
- // Description:
- // The doExtendSurfaceArgList() procedure executes a extend operation on
- // each selected object based on the extend option vars.
- //
- // Input Arguments:
- // None.
- //
- // Versions:
- // 1 - Maya V2
-
- proc string prepareExtendSurface( string $version, string $args[],
- int $forSurface )
- {
-
- string $cmd = "";
- int $need = 0;
- if( "1" == $version ) {
- $need = 8;
- }
- else {
- warning( "Bad version for doExtendSurfaceArgList. Assuming version 1.");
- $version = "1";
- $need = 8;
- }
-
- if( size($args) < $need ) {
- error( "Not enough arguments to doExtendSurfaceArgList" );
- return $cmd;
- }
-
- // Set up command strings for each command.
- string $cmd = "extendSurface";
- $cmd = $cmd + " -ch " + $args[0];
- $cmd = $cmd + " -em " + $args[1];
- $cmd = $cmd + " -et " + $args[2];
- $cmd = $cmd + " -d " + $args[3];
- $cmd = $cmd + " -jn " + $args[5];
-
- // If join is not set, force keep originals (rpo off)
- string $rpo = $args[6];
- int $join = $args[5];
- if( !$join ) {
- $rpo = "off";
- }
-
- $cmd = $cmd + " -rpo " + $rpo;
- if( $forSurface ) {
- $cmd = $cmd + " -es " + $args[4];
- $cmd = $cmd + " -ed " + $args[7];
- }
- $cmd = $cmd + " ";
-
- return $cmd;
- }
-
- global proc doExtendSurfaceArgList( string $version, string $args[] )
- {
- string $cmd = prepareExtendSurface( $version, $args, 1 );
- if( "" == $cmd ) return;
-
- // Get a list of each type of acceptable object type - surfaces+iso.
- //
- global int $gSelectNurbsSurfacesBit;
- global int $gSelectIsoparmsBit;
-
- string $surfaceList[] =`filterExpand -ex true -sm $gSelectNurbsSurfacesBit`;
- string $isoList[] = `filterExpand -ex true -sm $gSelectIsoparmsBit`;
-
- $cmd += " %s;";
- string $surfaceResults[] = executeForEachObject( $surfaceList, $cmd );
-
- // Processing isoparms is a little more involved. Use groupObjectsByName().
- // This big loop groups and processes >1 isoparms and sets the
- // direction of the command based on the isoparm direction.
- // Also, if the user selects an isoparm in each direction on the same
- // surface, this code assumes that the user wants to extend the
- // surface in BOTH directions.
- //
-
- $cmd = prepareExtendSurface( $version, $args, 0 );
-
- string $isoparmResults[];
- string $isoparms[] = groupObjectsByName( $isoList, "\\." );
- int $numIsoStrs = size($isoparms);
- for( $i = 0; $i < $numIsoStrs; $i ++ ) {
-
- string $extendCmd;
- string $results[];
- string $objectName[];
-
- $numNames = `tokenize $isoparms[$i] "\\." $objectName`;
- if( $numNames == 1 ) {
- $extendCmd = $cmd + $isoparms[$i];
- }
- else {
- string $foundU = `match "\\.u\\[" $isoparms[$i]`;
- string $foundV = `match "\\.v\\[" $isoparms[$i]`;
- if( size($foundU) > 0 && size($foundV) > 0 ) {
- $extendCmd = $cmd + "-ed 2 " + $objectName[0];
- }
- else if( size($foundU) > 0 ) {
- $extendCmd = $cmd + "-ed 0 " + $objectName[0];
- }
- else if( size($foundV) > 0 ) {
- $extendCmd = $cmd + "-ed 1 " + $objectName[0];
- }
- }
-
- if( catch( $results = evalEcho( $extendCmd )) ) {
- error(" Problem executing extend command: " + $extendCmd);
- }
- else {
- int $j;
- int $numResults = size( $results );
- int $numIsoResults = size( $isoparmResults );
- for( $j = 0; $j < $numResults; $j ++, $numIsoResults ++ ) {
- $isoparmResults[$numIsoResults] = $results[$j];
- }
- }
- }
-
- // Process all the results - if there weren't any then display a error
- //
- if( 0 == (size($surfaceResults) + size($isoparmResults)) ) {
- if( 0 == (size($surfaceList) + size($isoList)) ) {
- error ("Nothing was selected to extend. Select surfaces " +
- "or surface isoparm.");
- }
- else {
- warning( "Extend surface operation produced no results." );
- }
- } else {
- // Select all the results with one select command. Note that only
- // resulting surfaces and curves are selected, not dependency nodes.
- //
- string $selectString;
- $selectString = "select ";
- int $i;
-
- int $numSurfaces = size($surfaceResults);
- for( $i = 0; $i < $numSurfaces; $i ++ ) {
- $selectString += $surfaceResults[$i];
- $selectString += " ";
- }
-
- int $numIsos = size($isoparmResults);
- for( $i = 0; $i < $numIsos; $i ++ ) {
- $selectString += $isoparmResults[$i];
- $selectString += " ";
- }
-
- $selectString += ";";
- select -cl;
- eval($selectString);
- }
- }
-
-